﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AOC19NET.Controls {
	/// <summary>
	/// Interaction logic for EmailBox.xaml
	/// </summary>
	public partial class EmailBox : UserControl {
		#region RECEIVED TIME PROPERTY
			/// <summary>
			/// "ReceivedTime" property accessor.
			/// </summary>
			public DateTime m_ReceivedTime {
				get { return (DateTime)GetValue(s_CustomReceivedTimeProperty); }
				set { SetValue(s_CustomReceivedTimeProperty, (DateTime)value); }
			}

			/// <summary>
			/// "ReceivedTime" property definition and registration.
			/// </summary>
			public static DependencyProperty s_CustomReceivedTimeProperty =
				DependencyProperty.Register(
					"CustomReceivedTime", typeof(DateTime), typeof(EmailBox),
					new PropertyMetadata(DateTime.Now,
						new PropertyChangedCallback(ReceivedTimePropertyChangedCallback)
					)
				);

			/// <summary>
			/// "ReceivedTime" property change callback.
			/// </summary>
			/// <param name="_Sender">Event sender</param>
			/// <param name="_Arguments">Event arguments.</param>
			public static void ReceivedTimePropertyChangedCallback(DependencyObject _Sender, DependencyPropertyChangedEventArgs _Arguments) {
				EmailBox Sender = (EmailBox)_Sender;
				DateTime NewTime = (DateTime)_Arguments.NewValue;
				Sender.m_LabelDate.Content = NewTime.ToString("dd/MM/yy");
				Sender.m_LabelHour.Content = NewTime.ToString("HH:mm");
			}
		#endregion

		#region FROM PROPERTY
			/// <summary>
			/// "From" property accessor.
			/// </summary>
			public String m_sFrom {
				get { return (String)GetValue(s_CustomFromProperty); }
				set { SetValue(s_CustomFromProperty, (String)value); }
			}

			/// <summary>
			/// "From" property definition and registration.
			/// </summary>
			public static DependencyProperty s_CustomFromProperty =
				DependencyProperty.Register(
					"CustomFrom", typeof(String), typeof(EmailBox),
					new PropertyMetadata("",
						new PropertyChangedCallback(FromPropertyChangedCallback)
					)
				);

			/// <summary>
			/// "From" property change callback.
			/// </summary>
			/// <param name="_Sender">Event sender</param>
			/// <param name="_Arguments">Event arguments.</param>
			public static void FromPropertyChangedCallback(DependencyObject _Sender, DependencyPropertyChangedEventArgs _Arguments) {
				EmailBox Sender = (EmailBox)_Sender;
				Sender.m_LabelFrom.Content = (String)_Arguments.NewValue;
			}
		#endregion

		#region SUBJECT PROPERTY
			/// <summary>
			/// "Subject" property accessor.
			/// </summary>
			public String m_sSubject {
				get { return (String)GetValue(s_CustomSubjectProperty); }
				set { SetValue(s_CustomSubjectProperty, (String)value); }
			}

			/// <summary>
			/// "Subject" property definition and registration.
			/// </summary>
			public static DependencyProperty s_CustomSubjectProperty =
				DependencyProperty.Register(
					"CustomSubject", typeof(String), typeof(EmailBox),
					new PropertyMetadata("",
						new PropertyChangedCallback(SubjectPropertyChangedCallback)
					)
				);

			/// <summary>
			/// "Subject" property change callback.
			/// </summary>
			/// <param name="_Sender">Event sender</param>
			/// <param name="_Arguments">Event arguments.</param>
			public static void SubjectPropertyChangedCallback(DependencyObject _Sender, DependencyPropertyChangedEventArgs _Arguments) {
				EmailBox Sender = (EmailBox)_Sender;
				Sender.m_LabelSubject.Content = (String)_Arguments.NewValue;
			}
		#endregion

		#region BRIEF PROPERTY
			/// <summary>
			/// "Brief" property accessor.
			/// </summary>
			public String m_sBrief {
				get { return (String)GetValue(s_CustomBriefProperty); }
				set { SetValue(s_CustomBriefProperty, (String)value); }
			}

			/// <summary>
			/// "Brief" property definition and registration.
			/// </summary>
			public static DependencyProperty s_CustomBriefProperty =
				DependencyProperty.Register(
					"CustomBrief", typeof(String), typeof(EmailBox),
					new PropertyMetadata("",
						new PropertyChangedCallback(BriefPropertyChangedCallback)
					)
				);

			/// <summary>
			/// "Brief" property change callback.
			/// </summary>
			/// <param name="_Sender">Event sender</param>
			/// <param name="_Arguments">Event arguments.</param>
			public static void BriefPropertyChangedCallback(DependencyObject _Sender, DependencyPropertyChangedEventArgs _Arguments) {
				EmailBox Sender = (EmailBox)_Sender;
				Sender.m_TextBlockMessage.Text = (String)_Arguments.NewValue;
			}
		#endregion

		#region METHODS
			/// <summary>
			/// Default constructor;
			/// </summary>
			public EmailBox() {
				InitializeComponent();
			}
		#endregion
	}
}
